import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;

public class FileSearch2 {
    public static void main(String[] args) {
        String folderPath = "C:\\Users\\ASUS\\Desktop\\慧科项目\\eks-backend\\eks-backend\\weave\\service"; // 文件夹路径
        File folder = new File(folderPath);

        if (folder.isDirectory()) {
            File[] files = folder.listFiles();
            for (File file : files) {
                if (file.isFile()) {
                    searchInFile(file);
                }
            }
        }
    }

    public static void searchInFile(File file) {
        String fileName = file.getName();
        String filePath = file.getAbsolutePath();
        try (BufferedReader reader = new BufferedReader(new FileReader(file))) {
            String line;
            int lineNumber = 0;
            while ((line = reader.readLine()) != null) {
                lineNumber++;
                if (line.contains("http://") || line.contains("https://")) {
                    System.out.println("文件名：" + fileName + "，地址行：" + lineNumber + "，地址值：" + line);
                }
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
